﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="CarList.aspx.vb" Inherits="Final_Web_2._0_site_1.CarList" %>
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style4
        {
            width: 833px;
        }
        .style5
        {
            width: 15%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table class="style1">
        <tr>
            <td class="style5">
                <asp:GridView ID="GridView2" runat="server" AllowSorting="True" 
                    AutoGenerateColumns="False" DataKeyNames="TagID" 
                    DataSourceID="TagsListOnCarListSqlDataSource1" CellPadding="4" 
                    ForeColor="#333333" GridLines="None">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>
                        <asp:HyperLinkField HeaderText="Tags" DataNavigateUrlFields="TagName" 
                            DataNavigateUrlFormatString="~/CarListByTag.aspx?TagName={0}" 
                            DataTextField="TagName" />
                    </Columns>
                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
                <asp:SqlDataSource ID="TagsListOnCarListSqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:MercedesConnectionString %>" 
                    ProviderName="<%$ ConnectionStrings:MercedesConnectionString.ProviderName %>" 
                    SelectCommand="SELECT DISTINCT [TagID], [TagName] FROM [Tags]">
                </asp:SqlDataSource>
            </td>
            <td class="style4">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="CarID" DataSourceID="CarListSqlDataSource1" GridLines="None" 
                    CellPadding="4" ForeColor="#333333">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:TemplateField HeaderText="Picture">
                
           <ItemTemplate>
           <br />
           <asp:HyperLink ID="Hyperlink1" NavigateUrl ='<%# Eval("CarID", "CarInDetail.aspx?ID={0}") %>' runat ="server">
           <asp:Image ID="Image1" runat = "server" ImageUrl ='<%# Eval("CarPicture") %>' CssClass ="CarListImageSize" /> 
           </asp:HyperLink>
           <br />
                 Model:  <%# Eval("CarModelName")%><br />
                 Year: <%# Eval("CarModelYear")%><br />
                 </ItemTemplate>              
            </asp:TemplateField>
            </Columns>
            


            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
            


        </asp:GridView>
        <asp:SqlDataSource ID="CarListSqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MercedesConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:MercedesConnectionString.ProviderName %>" 
            SelectCommand="SELECT * FROM [Car]"></asp:SqlDataSource>
                <br />
            </td>
            <td width="50%">
                Cars with the most page visit.
                <br />
                <asp:Chart ID="Chart1" runat="server" 
                    DataSourceID="MostViewOnACarPageSqlDataSource1" >
                    
                    <series>
                        <asp:Series Name="Series1" XValueMember="CarModelName" 
                            YValueMembers="NumberOfVisit">
                        </asp:Series>
                    </series>
                    <chartareas>
                        <asp:ChartArea Name="ChartArea1">
                        </asp:ChartArea>
                    </chartareas>
                </asp:Chart>
                <asp:SqlDataSource ID="MostViewOnACarPageSqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:MercedesConnectionString %>" 
                    ProviderName="<%$ ConnectionStrings:MercedesConnectionString.ProviderName %>" 
                    SelectCommand="SELECT [NumberOfVisit], [CarModelName] FROM [MostViewCarPageQuery]">
                </asp:SqlDataSource>
            Cars with the most comments.<br />
                <asp:Chart ID="Chart2" runat="server" 
                    DataSourceID="MostCommentsOnCarsSqlDataSource" Palette="EarthTones">
                    <Series>
                        <asp:Series ChartType="Line" Name="Series1" XValueMember="CarModelName" 
                            YValueMembers="NumberOfComments" YValuesPerPoint="2">
                        </asp:Series>
                    </Series>
                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea1">
                        </asp:ChartArea>
                    </ChartAreas>
                </asp:Chart>
                <asp:SqlDataSource ID="MostCommentsOnCarsSqlDataSource" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:MercedesConnectionString %>" 
                    ProviderName="<%$ ConnectionStrings:MercedesConnectionString.ProviderName %>" 
                    SelectCommand="SELECT [CarModelName], [NumberOfComments] FROM [MostCommentsMadeOnACarQuery1]">
                </asp:SqlDataSource>
&nbsp;&nbsp;&nbsp;
                <br />
Cars which been highest rating.<br />
                <asp:Chart ID="Chart3" runat="server" DataSourceID="TopRatedCarSqlDataSource1" 
                    Palette="Berry">
                    <Series>
                        <asp:Series ChartType="Bar" Name="Series1" XValueMember="CarModelName" 
                            YValueMembers="TotalRating">
                        </asp:Series>
                    </Series>
                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea1">
                        </asp:ChartArea>
                    </ChartAreas>
                </asp:Chart>
                <asp:SqlDataSource ID="TopRatedCarSqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:MercedesConnectionString %>" 
                    ProviderName="<%$ ConnectionStrings:MercedesConnectionString.ProviderName %>" 
                    SelectCommand="SELECT [TotalRating], [CarModelName] FROM [TopRatedCarQuery]">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="MostRatedCarSqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:MercedesConnectionString %>" 
                    ProviderName="<%$ ConnectionStrings:MercedesConnectionString.ProviderName %>" 
                    SelectCommand="SELECT [TotalRating], [CarModelName] FROM [TopRatedCarQuery]">
                </asp:SqlDataSource>
            </td>
        </tr>
    </table>
    <p>
        &nbsp;</p>
    <p>
        <br />
    </p>
</asp:Content>
